package gov.cn.user.servlet;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/disp")
public class DispatchServlet {

    @GetMapping("/list")
    public String list(){

        return "list";
    }

    @GetMapping("/list2")
    public ModelAndView list2(HttpServletRequest request){
        ModelAndView modelAndView = new ModelAndView("list");
        return modelAndView;
    }

    @GetMapping("/baidu")
    public String redirect(){

        // 重定向是一个路径，也可以是外部路径
        return "redirect:http://www.baidu.com";
        //return "redirect:dispatcher";
        //return "redirect:/dr/dispatcher";
        //return "redirect:/hello6";
    }

}
